/*    */ package org.flashzlm.tools.ui;
/*    */ 
/*    */ import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JPanel;
/*    */ 
/*    */ public class GuaShape extends JPanel
/*    */ {
/**
	 * 
	 */
	private static final long serialVersionUID = 4029974636284706615L;
/*    */   private List<Integer> sixYaos;
/*    */   private int dongYao;
/*    */ 
           private int currYao;

           public void setCurrYao(int currYao){
        	   this.currYao=currYao;
        	   repaint();
           }
//           public void update(Graphics g){
//        	   paint(g);
//        	   
//           }
/*    */   public void setDongYao(int dongYao)
/*    */   {
/* 19 */     this.dongYao = dongYao;
/*    */   }
/*    */ 
/*    */   public void setSixYaos(List<Integer> sixYaos) {
/* 23 */     if (sixYaos == null) {
/* 24 */       this.sixYaos = null;
/* 25 */       return;
/*    */     }
/* 27 */     this.sixYaos = sixYaos;
/* 28 */   } 
/*    */   protected void paintComponent(Graphics g) { super.paintComponent(g);
/* 43 */     if (currYao == 0) {
/* 44 */       Font sansbold = new Font("SansSerif", 1, 25);
/* 45 */       g.setFont(sansbold);
/* 46 */       g.drawString("卦形", 10, 43);
/* 47 */       return;
/*    */     }
/* 49 */     Graphics2D g2 = (Graphics2D)g;
/* 50 */     for (int i = 0; i < currYao; ++i)
/* 51 */       paintYao(g2, i);
/*    */   }
/*    */ 
/*    */   private void paintYao(Graphics2D g2, int yaoNum)
/*    */   {
/* 56 */     if ((yaoNum + 1 == this.dongYao) || (this.dongYao == 7))
/* 57 */       g2.setPaint(new Color(60, 90, 190));
/*    */     else {
/* 59 */       g2.setPaint(new Color(120, 150, 190));
/*    */     }
/* 61 */     double leftX = 10.0D;
/* 62 */     double topY = 75 - (yaoNum * 14);
/* 63 */     double width = 55.0D;
/* 64 */     double height = 10.0D;
/* 65 */     Rectangle2D rect = null;
/* 66 */     Rectangle2D rect2 = null;
             int value= this.sixYaos.get(yaoNum).intValue();
/* 67 */     if (value == 7||value==9||value==1) {
/* 68 */       rect = new Rectangle2D.Double(leftX, topY, width, height);
				
/*    */     } else {
/* 70 */       rect = new Rectangle2D.Double(leftX, topY, 26.0D, height);
/* 71 */       rect2 = new Rectangle2D.Double(leftX + 29.0D, topY, 26.0D, height);
/* 72 */       g2.fill(rect2);
/*    */     }
/* 74 */     g2.fill(rect);
/*    */   }
/*    */ }

